//################################################################################################################################//
//##                                                                                                                            ##//
//## This User Control is implement for show the rating                                                                ##//
//##                                                                                                                            ##//
//## Author   : Sharvan                                                                                                         ##//
//## Dated    : 17-03-2006                                                                                                      ##//
//##                                                                                                                            ##//
//################################################################################################################################//


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class includes_showRateforMyRating : System.Web.UI.UserControl
{
    decimal _rating = 0.00M;
    public int FullRate = 0;
    public bool halfRate = false;  
    public decimal rate
    {
        set { _rating = value; }
        get { return _rating; }
    }
    decimal _totalScore = 5;
    public decimal totalScore
    {
        set { _totalScore = value; }
        get { return _totalScore; }
    }  

    string _imageName = "plus";
    public string imageName
    {
        get { return _imageName; }
        set { _imageName = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {        
        getRating();
    }
    protected void getRating()
    {
        if (this.rate > totalScore)
            this.rate = totalScore;
        this.rate = this.rate / (this.totalScore / 5);                
        FullRate =(int)Math.Round(rate, 0);
        
        //FullRate = (int)Math.Truncate(rate); //cR;		
        //if ((Math.Round((Math.Round(rate, 1) - FullRate), 1) >= .3M && (Math.Round((Math.Round(rate, 1) - FullRate), 1)) <= .7M))
        //    halfRate = true;
        //if ((Math.Round((Math.Round(rate, 1) - FullRate), 1)) > .7M)
        //    FullRate += 1;
    }
}
